package com.bgds.sys.module.serviceimpl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bgds.sys.module.entity.DeviceStaticAttr;
import com.bgds.sys.module.mapper.DeviceStaticAttrMapper;
import com.bgds.sys.module.service.IDeviceStaticAttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lj
 * @since 2020-01-06
 */
@Service
public class IDeviceStaticAttrServiceImpl extends ServiceImpl<DeviceStaticAttrMapper, DeviceStaticAttr> implements IDeviceStaticAttrService {



    @Autowired
    private DeviceStaticAttrMapper deviceStaticAttrMapper;


    /**
     *根据设备的Code查询设备静态属性
     * @param deviceCode 设备code
     * @return
     */
    @Override
    public List<DeviceStaticAttr> getStaticAttByDeviceCode(String deviceCode) {
        QueryWrapper qw1 = new QueryWrapper();
        qw1.eq("device_code",deviceCode);
        return deviceStaticAttrMapper.selectList(qw1);
    }

    @Override
    public List<DeviceStaticAttr> queryByNameWithDeviceCode(String name, String deviceCode) {
        QueryWrapper qw1 = new QueryWrapper();
        qw1.eq("device_code",deviceCode);
        qw1.eq("name",name);
        return deviceStaticAttrMapper.selectList(qw1);
    }
}
